package me.cxlr.qinlauncher2.view.settings;

import android.os.Bundle;

import androidx.navigation.fragment.NavHostFragment;
import androidx.preference.DropDownPreference;
import androidx.preference.PreferenceFragmentCompat;

import me.cxlr.qinlauncher2.R;
import me.cxlr.qinlauncher2.util.ThemeUtil;

/**
 * @author 酷安用户:山轮纸
 */
public class DesktopSettingsFragment extends PreferenceFragmentCompat {

    @Override
    public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
        setPreferencesFromResource(R.xml.preferences_desktop_settings, rootKey);

        // 桌面设置->Dock设置
        DropDownPreference dockSettings = findPreference("dock_settings");
        assert dockSettings != null;
        dockSettings.setOnPreferenceClickListener(preference -> {
            NavHostFragment.findNavController(DesktopSettingsFragment.this).navigate(R.id.action_desktopSettingsFragment_to_dockSettingsFragment);
            return true;
        });
    }

    @Override
    public void onResume() {
        super.onResume();
        ThemeUtil.initTheme();
    }
}